package 算法回顾;

import java.util.*;

/**
 * @author : K k
 * @date : 21:04 2020/9/6
 */
public class demo3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        List<String> lists=new ArrayList<>();
        for (int i=0;i<n+1;i++ ){
            String line=sc.nextLine();
            lists.add(line);
        }

        printk(lists,k);

    }

    public static void printk(List<String> lists, int k){
        Map<Character,Integer> map=new HashMap<>();
        for (int i=0;i<lists.size();i++){
            int length = lists.get(i).length();
            String s1=lists.get(i);
            for (int j=0;j<length;j++){
                if (map.containsKey(s1.charAt(j))){
                    map.put((Character)s1.charAt(j),map.get(s1.charAt(j))+1);
                }else {
                    map.put((Character)s1.charAt(j),1);
                }
            }
        }
        Set<Map.Entry<Character, Integer>> entries = map.entrySet();
        Iterator<Map.Entry<Character, Integer>> iterator = entries.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

        System.out.println(map.entrySet());

    }
}
